//construct inventor data we will use

import delimited "${rawdata}all-results.txt", clear
rename v1 application_number
rename v2 raw_uuid
rename v3 inventor_disambiguated
rename v4 firstname
rename v5 middlename
rename v6 lastname
drop v7
rename v8 state
rename v9 filing_date
rename v10 invention_title

rename * *_disambig
rename application_number_disambig application_number
rename firstname_disambig firstname
rename lastname_disambig lastname

duplicates drop
duplicates tag application_number firstname lastname, gen(dup_id)
//tab dup_id
drop if dup_id > 0
drop dup_id
tostring application_number, replace

keep application_number inventor_disambiguated_disambig 
save "${filedata}disambig_formerge.dta", replace
